package com.design.memento;

import java.util.ArrayList;

/**
 * @author leali
 * @title: MementoCaretaker
 * @projectName design
 * @description: 象棋棋子备忘录管理类：负责人
 * @date 2022/1/3 20:16
 */
public class MementoCaretaker {
    private ChessmanMemento memento;
    /**
     * 定义一个集合来存储多个备忘录
     * 为了实现多次撤销
     */
    private final ArrayList<ChessmanMemento> mementos = new ArrayList<>();

    public ChessmanMemento getMemento() {
        return memento;
    }

    public ChessmanMemento getMemento(int i) {
        return mementos.get(i);
    }

    public void setMemento(ChessmanMemento memento) {
        this.memento = memento;
    }

    public void setMementoList(ChessmanMemento memento) {
        mementos.add(memento);
    }
}
